<template>
	<view class="page">
		<!-- 顶部信息区 -->
		<view class="header-card">
			<view class="header-title">
				<text class="title-text">结算详情</text>
				<text class="status-text">已完成</text>
			</view>
			<view class="amount-section">
				<text class="amount">¥ {{detailInfo.rewardAmount/100}}</text>
				<text class="amount-label">实际收入</text>
			</view>
		</view>

		<!-- 结算信息模块 -->
		<view class="info-card">
			<view class="info-item">
				<text class="info-label">结算周期</text>
				<text class="info-value">{{dayjs(detailInfo.createTime).year()}}-{{getWeekOfYear(detailInfo.createTime)}}周</text>
			</view>
			<view class="divider"></view>
			<view class="info-item">
				<text class="info-label">结算时间</text>
				<text class="info-value">{{dayjs(detailInfo.rewardTime).format('YYYY-MM-DD HH:mm')}}</text>
			</view>
		</view>

		<!-- 数据统计区域 -->
		<view class="stats-section">
			<view class="stat-card">
				<text class="stat-number">--</text>
				<text class="stat-label">合格订单</text>
			</view>
			<view class="stat-card">
				<text class="stat-number">--</text>
				<text class="stat-label">不合格订单</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import dayjs from '@/utils/dayjs.main.js'
	import {getWeekOfYear} from '../../utils/commonUtils.js'
	import {
		onMounted,
		ref
	} from 'vue';
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		request
	} from "@/utils/api";
	const detailInfo = ref({})
	const getDetail = (id) => {
		request({
			url: `/sanitation/v1/reward_records/${id}`,
			method: 'GET',
		}).then(res => {
			detailInfo.value = res
		})
	}
	onLoad((options) => {

		getDetail(options.id)
	})
</script>

<style>
	page {
		height: 100%;
		background-color: #f8f8f8;
	}

	.page {
		padding: 30rpx;
		display: flex;
		flex-direction: column;
		height: 100%;
	}

	/* 顶部信息区样式 */
	.header-card {
		background-color: #ffffff;
		border-radius: 16rpx;
		padding: 30rpx;
		margin-bottom: 30rpx;
		box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
	}

	.header-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 40rpx;
	}

	.title-text {
		font-size: 32rpx;
		font-weight: 600;
		color: #333333;
	}

	.status-text {
		font-size: 26rpx;
		color: #07C160;
		padding: 6rpx 16rpx;
		background-color: rgba(7, 193, 96, 0.1);
		border-radius: 20rpx;
	}

	.amount-section {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.amount {
		font-size: 60rpx;
		font-weight: 700;
		color: #333333;
		font-family: 'Courier New', Courier, monospace;
		margin-bottom: 10rpx;
	}

	.amount-label {
		font-size: 26rpx;
		color: #999999;
	}

	/* 结算信息模块样式 */
	.info-card {
		background-color: #ffffff;
		border-radius: 16rpx;
		padding: 0 30rpx;
		margin-bottom: 30rpx;
		box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
	}

	.info-item {
		display: flex;
		justify-content: space-between;
		padding: 30rpx 0;
	}

	.info-label {
		font-size: 28rpx;
		color: #666666;
	}

	.info-value {
		font-size: 28rpx;
		color: #333333;
		font-weight: 500;
	}

	.divider {
		height: 1px;
		background-color: #f0f0f0;
	}

	/* 数据统计区域样式 */
	.stats-section {
		display: flex;
		justify-content: space-between;
		margin-bottom: 30rpx;
	}

	.stat-card {
		background-color: #ffffff;
		border-radius: 16rpx;
		padding: 30rpx;
		width: 48%;
		display: flex;
		flex-direction: column;
		align-items: center;
		box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
	}

	.stat-number {
		font-size: 48rpx;
		font-weight: 700;
		color: #333333;
		font-family: 'Courier New', Courier, monospace;
		margin-bottom: 10rpx;
	}

	.stat-card:first-child .stat-number {
		color: #07C160;
	}

	.stat-card:last-child .stat-number {
		color: #FF4D4F;
	}

	.stat-label {
		font-size: 26rpx;
		color: #999999;
	}
</style>